/**
 * This file is part of Idegen, the application to create IDE project files.
 *
 * @copyright Copyright (c) 2011-2012, Walter Tamboer http://waltertamboer.nl
 * @file Idegen/Idegen/IdegenProject.hpp
 */

#ifndef IDEGEN_IDEGEN_IDEGENPROJECT_HPP
#define IDEGEN_IDEGEN_IDEGENPROJECT_HPP

namespace Idegen
{
	enum IdegenProjectType;

	class IdegenSourceSet;
	class IdegenProjectConfig;
	
	typedef std::vector< IdegenSourceSet* > IdegenSourceSetList;
	typedef std::vector< IdegenProjectConfig* > IdegenProjectConfigList;

	/** The definition of a project. */
	class IdegenProject
	{
	public:
		/** Initializes a new instance of this class. */
		IdegenProject();

		/** Cleans up all the resources used by this class. */
		virtual ~IdegenProject();

		/**
		 * Gets the name of the project.
		 *
		 * @return Returns a string containing the name of the project.
		 */
		std::string GetName() const;

		/**
		 * Gets the output path of this project.
		 *
		 * @return Returns a string which can be the relative or the absolute path of the project.
		 */
		std::string GetOutputPath() const;

		/**
		 * Gets a list with all the project configurations.
		 *
		 * @return Returns a list with all the project configurations.
		 */
		IdegenProjectConfigList GetConfigs() const;

		/**
		 * Gets the list of all source sets that this project has.
		 *
		 * @return Returns a list with all the source sets.
		 */
		IdegenSourceSetList GetSources() const;

		/**
		 * Gets the type of this project.
		 *
		 * @return Returns the project type.
		 */
		IdegenProjectType GetType() const;

		/**
		 * Unserializes a project.
		 *
		 * @param[in] settings The settings used to parse.
		 * @param[in] parent The parent element.
		 */
		void Unserialize( Settings* settings, TiXmlElement* parent );

	private:
		/**
		 * Parses the attributes.
		 *
		 * @param[in] settings The settings used to parse.
		 * @param[in] parent The element to parse.
		 */
		void ParseAttributes( Settings* settings, TiXmlElement* parent );

		/**
		 * Parses a configuration.
		 *
		 * @param[in] settings The settings used to parse.
		 * @param[in] parent The element to parse.
		 */
		void ParseConfiguration( Settings* settings, TiXmlElement* parent );

		/**
		 * Parses a source set.
		 *
		 * @param[in] settings The settings used to parse.
		 * @param[in] parent The element to parse.
		 */
		void ParseSource( Settings* settings, TiXmlElement* parent );

		/** The name of this project. */
		std::string m_Name;

		/** The path to output this project to. */
		std::string m_OutputPath;

		/** The type of this project. */
		IdegenProjectType m_Type;

		/** A list with all the sources that this project has. */
		IdegenSourceSetList m_Sources;

		/** A list with all the project configs. */
		IdegenProjectConfigList m_Configs;
	};
}

#endif
